home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / spllib.zip / SPLPRESS < prev    next >
Text File  |  1987-10-10  |  9KB  |  396 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         FOR IMMEDIATE RELEASE                                    10/10/87
  8.  
  9.                                                       CONTACT Dennis Baer
  10.  
  11.                                                              516 694 5872
  12.  
  13.         Software   author   Dennis  Baer  has  released  the   Structured 
  14.         Programming  Language,  (SPL)  a  free  format  block  structured 
  15.         programming  language  that  runs on PCDOS  and  MSDOS  operating 
  16.         systems. SPL is an alternative to PASCAL and C.
  17.  
  18.              SPL will also run on an AMIGA 2000 with an IBM bridge, AMIGA
  19.         1000  with the SIDECAR or the transformer IBM emulator, or  other
  20.         micros that have IBM addons.
  21.  
  22.              The  SPL  language  is implemented  by  a  translator  which 
  23.         converts  SPL source code to a Microsoft BASIC program which  can 
  24.         then  be compiled with Microsoft's Quick Basic,  MS BASIC,  IBM's 
  25.         BASICA, or ported to machines such as AMIGA, MACINTOSH, ATARI ST, 
  26.         or CP/M and compiled with the BASIC compiler for those machines.
  27.  
  28.         SPL  has  been released as SHARE WARE and is  available  as  file 
  29.         SPLLIB.ARC  on  BIX, Compuserve, DELPHI, SOURCE, GENIE or on bbs 
  30.         systems:
  31.  
  32.         516 334 8221
  33.         516 367 9626
  34.  
  35.         SPL is also available as volume 666 from PCSIG at 800 245 6717.
  36.  
  37.         If  you  have any questions you may call me at 516-694-5872  from 
  38.         Monday thru Friday from 10:00 am to 6:30 pm New York time.
  39.  
  40.                  
  41.         Some major features and advantages of SPL
  42.                  
  43.         o SPL is an alternative to the PASCAL and C languages
  44.  
  45.         o SPL programs can be run on MACINTOSH,AMIGA,ATARI ST,CP/M
  46.  
  47.         o The SPL processor will run on MSDOS emulators on MACINTOSH,
  48.           AMIGA,ATARI ST
  49.  
  50.         o PROCEDURES
  51.  
  52.         o WHILE loops
  53.  
  54.         o FOR loops with REAL and INTEGER indicies and increments
  55.  
  56.         o REPEAT loops
  57.  
  58.  
  59.  
  60.                                         1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.         o Powerful IF THEN ELSE constructs
  70.  
  71.         o Powerful RANDOM and SEQUENTIAL INPUT/OUTPUT including
  72.           formatted OUTPUT
  73.  
  74.         o GRAPHICS statements PSET DRAW LINE CIRCLE PRESET SCREEN .....
  75.  
  76.         o BEGIN END blocks
  77.  
  78.         o ERROR trapping
  79.  
  80.         o Statement labels (multiple labels supported)
  81.  
  82.         o Strong data types INTEGER REAL STRING scalars and arrays
  83.  
  84.         o Names of variables and labels up to 40 characters upper and
  85.           lower case
  86.  
  87.         o Supports mathematical functions SIN COS TAN LOG EXP .....
  88.  
  89.         o STRING functions MID$ LEFT$ RIGHT$ STR$ VAL$ ASC$ .....
  90.  
  91.         o Your compiled BASIC programs do not become obsolete link
  92.           them together
  93.  
  94.         o SPL programs run faster than PASCAL programs
  95.  
  96.         o SPL programs can take advantage of an entire 640k IBM PC
  97.  
  98.         o The SPL processor will work on an IBM PCjr with 128k and
  99.           1 drive
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                         2
  127.  
  128.  
  129.  
  130.  
  131. This is a sample program written in the Structured Programming Language.
  132.  
  133.  
  134.  BEGIN
  135.   
  136.   COMMENT
  137.           This program will plot a set of points in three 
  138.           dimensions using the high resolution graphics.   ;
  139.  
  140.   REAL extent,vx,vy,topx,topy;
  141.   REAL ARRAY x(500),y(500),z(500);
  142.   INTEGER limit,i;
  143.  
  144.   PROCEDURE Plotter;
  145.   BEGIN
  146.    COMMENT This procedure scales and plots the points on
  147.            the computer screen. ;
  148.  
  149.    INTEGER i;
  150.    REAL maxx,maxy,minx,miny,difx,dify;
  151.  
  152.    maxx := -1*10^30; maxy := maxx; minx := 1*10^30; miny := minx;
  153.    topx := 639; topy := 200;
  154.  
  155.    FOR i := 1 STEP 1 UNTIL limit DO
  156.    BEGIN
  157.     IF x(i) >= maxx THEN maxx := x(i);
  158.     IF x(i) <= minx THEN minx := x(i);
  159.     IF y(i) >= maxy THEN maxy := y(i);
  160.     IF y(i) <= miny THEN miny := y(i);
  161.    END
  162.  
  163.    COMMENT The maximum and minimum x and y values are computed. ;
  164.  
  165.    difx := maxx-minx; dify := maxy-miny;
  166.  
  167.    FOR i := 1 STEP 1 UNTIL limit DO
  168.    BEGIN
  169.     x(i) := ((x(i)-minx)/difx)*topx;
  170.     y(i) := ((y(i)-miny)/dify)*topy;
  171.     PSET(x(i),topy-y(i)),7;
  172.    END
  173.  
  174.   END
  175.  
  176.   PROCEDURE Convert_3D_to_2D;
  177.   BEGIN
  178.  
  179.    COMMENT This procedure converts 3 dimensional coordinates to
  180.            2 dimensional coordinates.                           ;
  181.  
  182.    REAL cosine_45,sine_45;
  183.    INTEGER i;
  184.  
  185.    cosine_45 := COS((45.*3.14159)/180.);
  186.    sine_45 := SIN((45.*3.14159)/180.);
  187.  
  188.    FOR i := 1 STEP 1 UNTIL limit DO
  189.    BEGIN
  190.     x(i) := x(i) + (extent-y(i))*cosine_45;
  191.     y(i) := z(i) + (extent-y(i))*sine_45;
  192.    END
  193.  
  194.   END
  195.  
  196.  
  197.  
  198.   COMMENT This is the start of the main program. ;
  199.  
  200.  
  201.  
  202.   HOME; SCREEN 2;
  203.  
  204.   Start_plot:
  205.  
  206.   INPUT('Enter the scale factor:' @ extent); HOME;
  207.   
  208.   OUTPUT('.... WAIT ....');
  209.  
  210.   IF extent < 0 THEN GO Finish;
  211.   i:=1;
  212.   FOR vx := -1. STEP .1 UNTIL 1. DO
  213.   BEGIN
  214.    FOR vy := -1. STEP .1 UNTIL 1. DO
  215.    BEGIN
  216.     x(i) := vx; y(i) := vy; z(i) := SQR(2.-vx^2-vy^2); i := i+1;
  217.    END
  218.   END
  219.  
  220.   COMMENT Points have been computed,now set up axes. ;
  221.  
  222.   x(i+1) := extent; y(i+1) := 0; z(i+1) := 0;
  223.   x(i+2) := -extent; y(i+2) := 0; z(i+2) := 0;
  224.   x(i+3) := 0; y(i+3) := extent; z(i+3) := 0;
  225.   x(i+4) := 0; y(i+4) := -extent; z(i+4) := 0;
  226.   x(i+5) := 0; y(i+5) := 0; z(i+5) := extent;
  227.   x(i) := 0; y(i) := 0; z(i) := -extent;
  228.   limit := i+5;
  229.  
  230.  
  231.   Convert_3D_to_2D;
  232.  
  233.   HOME;
  234.  
  235.   Plotter;
  236.  
  237.   OUTPUT( DATE$ + ' ' + TIME$ );
  238.  
  239.   LINE (x(i+1),topy-y(i+1)) - (x(i+2),topy-y(i+2)),7;
  240.   LINE (x(i+3),topy-y(i+3)) - (x(i+4),topy-y(i+4)),7;
  241.   LINE (x(i),topy-y(i)) - (x(i+5),topy-y(i+5)),7;
  242.  
  243.   Busy: IF INKEY$ = '' THEN GO TO Busy;
  244.         ELSE GO TO Start_plot;
  245.  
  246.   Finish:
  247.  END 
  248.  
  249.  
  250. This is the resulting BASIC program after being sorted by the sort utility
  251. SORT.EXE that is supplied with most MSDOS and PCDOS systems.
  252.  
  253.    2 OPTION BASE 1
  254.    3 DIM AZ( 13 ),A%( 4 ),A$( 1 ),B$( 1 )
  255.    4 DIM AAZ(500)
  256.    5 DIM ABZ(500)
  257.    6 DIM ACZ(500)
  258.  503 COMMON AZ(),A%(),A$(),B$()
  259.  504 COMMON AAZ()
  260.  505 COMMON ABZ()
  261.  506 COMMON ACZ()
  262. 1001 GOTO 1045
  263. 1002 ::
  264. 1003 AZ(6)=-1*10^30
  265. 1004 AZ(7)=AZ(6)
  266. 1005 AZ(8)=1*10^30
  267. 1006 AZ(9)=AZ(8)
  268. 1007 AZ(4)=639
  269. 1008 AZ(5)=200
  270. 1009 FOR AA%=1 TO A%(1) STEP 1
  271. 1010 A%(3)=AA%
  272. 1011 IF AAZ(A%(3))>=AZ(6) THEN 1013
  273. 1012 GOTO 1015
  274. 1013 AZ(6)=AAZ(A%(3))
  275. 1014 GOTO 1016
  276. 1015 :
  277. 1016 :
  278. 1017 IF AAZ(A%(3))<=AZ(8) THEN 1019
  279. 1018 GOTO 1021
  280. 1019 AZ(8)=AAZ(A%(3))
  281. 1020 GOTO 1022
  282. 1021 :
  283. 1022 :
  284. 1023 IF ABZ(A%(3))>=AZ(7) THEN 1025
  285. 1024 GOTO 1027
  286. 1025 AZ(7)=ABZ(A%(3))
  287. 1026 GOTO 1028
  288. 1027 :
  289. 1028 :
  290. 1029 IF ABZ(A%(3))<=AZ(9) THEN 1031
  291. 1030 GOTO 1033
  292. 1031 AZ(9)=ABZ(A%(3))
  293. 1032 GOTO 1034
  294. 1033 :
  295. 1034 :
  296. 1035 NEXT
  297. 1036 AZ(10)=AZ(6)-AZ(8)
  298. 1037 AZ(11)=AZ(7)-AZ(9)
  299. 1038 FOR AB%=1 TO A%(1) STEP 1
  300. 1039 A%(3)=AB%
  301. 1040 AAZ(A%(3))=((AAZ(A%(3))-AZ(8))/AZ(10))*AZ(4)
  302. 1041 ABZ(A%(3))=((ABZ(A%(3))-AZ(9))/AZ(11))*AZ(5)
  303. 1042 PSET(AAZ(A%(3)),AZ(5)-ABZ(A%(3))),7
  304. 1043 NEXT
  305. 1044 RETURN
  306. 1045 :
  307. 1046 GOTO 1056
  308. 1047 ::
  309. 1048 AZ(12)=COS((45.*3.14159)/180.)
  310. 1049 AZ(13)=SIN((45.*3.14159)/180.)
  311. 1050 FOR AC%=1 TO A%(1) STEP 1
  312. 1051 A%(4)=AC%
  313. 1052 AAZ(A%(4))=AAZ(A%(4))+(AZ(1)-ABZ(A%(4)))*AZ(12)
  314. 1053 ABZ(A%(4))=ACZ(A%(4))+(AZ(1)-ABZ(A%(4)))*AZ(13)
  315. 1054 NEXT
  316. 1055 RETURN
  317. 1056 :
  318. 1057 CLS
  319. 1058 SCREEN 2
  320. 1059 :
  321. 1060 INPUT "Enter the scale factor:";AZ(1)
  322. 1061 CLS
  323. 1062 PRINT ".... WAIT ...."
  324. 1063 IF AZ(1)<0 THEN 1065
  325. 1064 GOTO 1067
  326. 1065 GOTO 1114
  327. 1066 GOTO 1068
  328. 1067 :
  329. 1068 :
  330. 1069 A%(2)=1
  331. 1070 FOR AD=-1. TO 1. STEP .1
  332. 1071 AZ(2)=AD
  333. 1072 FOR AE=-1. TO 1. STEP .1
  334. 1073 AZ(3)=AE
  335. 1074 AAZ(A%(2))=AZ(2)
  336. 1075 ABZ(A%(2))=AZ(3)
  337. 1076 ACZ(A%(2))=SQR(2.-AZ(2)^2-AZ(3)^2)
  338. 1077 A%(2)=A%(2)+1
  339. 1078 NEXT
  340. 1079 NEXT
  341. 1080 AAZ(A%(2)+1)=AZ(1)
  342. 1081 ABZ(A%(2)+1)=0
  343. 1082 ACZ(A%(2)+1)=0
  344. 1083 AAZ(A%(2)+2)=-AZ(1)
  345. 1084 ABZ(A%(2)+2)=0
  346. 1085 ACZ(A%(2)+2)=0
  347. 1086 AAZ(A%(2)+3)=0
  348. 1087 ABZ(A%(2)+3)=AZ(1)
  349. 1088 ACZ(A%(2)+3)=0
  350. 1089 AAZ(A%(2)+4)=0
  351. 1090 ABZ(A%(2)+4)=-AZ(1)
  352. 1091 ACZ(A%(2)+4)=0
  353. 1092 AAZ(A%(2)+5)=0
  354. 1093 ABZ(A%(2)+5)=0
  355. 1094 ACZ(A%(2)+5)=AZ(1)
  356. 1095 AAZ(A%(2))=0
  357. 1096 ABZ(A%(2))=0
  358. 1097 ACZ(A%(2))=-AZ(1)
  359. 1098 A%(1)=A%(2)+5
  360. 1099 GOSUB 1